﻿<Views:WindowBase x:Class="SharpTalk.Client.WpfApplication.Views.SettingsView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:Controls="clr-namespace:SharpTalk.Client.WpfApplication.Controls"
        xmlns:Resources="clr-namespace:SharpTalk.Client.WpfApplication.Resources"
        xmlns:Views="clr-namespace:SharpTalk.Client.WpfApplication.Views"
        mc:Ignorable="d" 
        d:DesignHeight="341" d:DesignWidth="462" MinWidth="230" 
        Style="{StaticResource MessageViewStyle}"
        SizeToContent="WidthAndHeight">
    <Grid Margin="10,0,10,0">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" MinHeight="30"/>
            <RowDefinition Height="Auto" MinHeight="30"/>
            <RowDefinition Height="Auto" MinHeight="30"/>
            <RowDefinition Height="Auto" MinHeight="30"/>
            <RowDefinition Height="Auto" MinHeight="30"/>
            <RowDefinition Height="Auto" MinHeight="30"/>
            <RowDefinition Height="Auto" MinHeight="30"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <TextBlock TextWrapping="Wrap" MaxWidth="180" Text="{x:Static Resources:Messages.settings_local_endpoint_uri}" VerticalAlignment="Center"  HorizontalAlignment="Right" Grid.Row="0" Grid.Column="0" Margin="5,0"/>
        <Grid Grid.Row="0" Grid.Column="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" MinWidth="70"/>
            </Grid.ColumnDefinitions>
            <TextBox IsEnabled="False" VerticalAlignment="Center" Text="{Binding Path=LocalServiceUriHost,Mode=OneTime}" Margin="2" Grid.Column="0" />
            <TextBlock Text="{x:Static Resources:Messages.settings_local_endpoint_port}" Grid.Column="1" VerticalAlignment="Center" Margin="5,0,2,0" />
            <TextBox  VerticalAlignment="Center" Text="{Binding Path=LocalServiceUriPort, UpdateSourceTrigger=PropertyChanged}" Margin="2" Grid.Column="2" />
        </Grid>
        
        <TextBlock TextWrapping="Wrap" MaxWidth="180" Text="{x:Static Resources:Messages.settings_server_address}" VerticalAlignment="Center"  HorizontalAlignment="Right" Grid.Row="1" Grid.Column="0" Margin="5,0"/>
        <TextBox IsEnabled="False"  VerticalAlignment="Center" Text="{Binding Path=Server,Mode=OneTime}" Margin="2" Grid.Row="1" Grid.Column="1" />

        <TextBlock TextWrapping="Wrap" MaxWidth="180" Text="{x:Static Resources:Messages.label_culture}" VerticalAlignment="Center"  HorizontalAlignment="Right" Grid.Row="2" Grid.Column="0" Margin="5,0"/>
        <ComboBox  ItemsSource="{Binding Cultures}" SelectedValue="{Binding SelectedCulture}" Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" DisplayMemberPath="NativeName" SelectedValuePath="Name" Margin="2"/>

        <TextBlock TextWrapping="Wrap" MaxWidth="180" Text="{x:Static Resources:Messages.settings_max_messages_count}" VerticalAlignment="Center"  HorizontalAlignment="Right" Grid.Row="3" Grid.Column="0" Margin="5,0"/>
        <Slider Minimum="10" Maximum="100" Value="{Binding MaximumMessageCount}" AutoToolTipPlacement="TopLeft" Interval="10" IsMoveToPointEnabled="True" VerticalAlignment="Center"  HorizontalAlignment="Stretch" Grid.Row="3" Grid.Column="1" Margin="5,0" TickPlacement="TopLeft" TickFrequency="10" LargeChange="10" SmallChange="10" IsSnapToTickEnabled="True" />

        <TextBlock TextWrapping="Wrap" MaxWidth="180" Text="{x:Static Resources:Messages.settings_save_messages}" VerticalAlignment="Center"  HorizontalAlignment="Right" Grid.Row="4" Grid.Column="0" Margin="5,0"/>
        <CheckBox IsChecked="{Binding SaveMessages}" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Row="4" Grid.Column="1" Margin="5,0"/>

        <TextBlock TextWrapping="Wrap" MaxWidth="180" Text="{x:Static Resources:Messages.settings_trace_level}" VerticalAlignment="Center"  HorizontalAlignment="Right" Grid.Row="5" Grid.Column="0" Margin="5,0"/>
        <ComboBox  ItemsSource="{Binding TraceLevels, Converter={StaticResource SourceLevelsToStringConverter}}" SelectedValue="{Binding SelectedTraceLevel, Converter={StaticResource SourceLevelsToStringConverter}}" Grid.Row="5" Grid.Column="1" VerticalAlignment="Center" Margin="2"/>
        
        <DockPanel Visibility="{Binding NeedRestart, Converter={StaticResource BooleanToVisibilityConverter}}" Grid.Row="6" Grid.ColumnSpan="2" Margin="5,0" LastChildFill="True">
            <Image Style="{StaticResource ImageStyleAlert}" Width="24" Height="24" Margin="5,0" Effect="{StaticResource DropShadowEffectLight}" Stretch="Fill"/>
            <TextBlock TextWrapping="NoWrap"  Text="{x:Static Resources:Messages.label_need_restart}" VerticalAlignment="Center"  HorizontalAlignment="Left" Margin="5,0"/>
        </DockPanel>
        
        <Controls:DialogActionsPanel 
            Grid.Row="8"
            Grid.ColumnSpan="2"
            HorizontalAlignment="Right"
            VerticalAlignment="Bottom"
            ShowButtonOk="True"
            ShowButtonCancel="True"
            ButtonOkContent="{x:Static Resources:Messages.label_save}"
            ButtonOkCommand="{Binding ValidateCommand}"
            ButtonOkIsDefault="True"/>
    </Grid>
</Views:WindowBase>
